function padZero (num) {
	return num.toString().padStart(2, '0')
}

function formatDatetime (datetimeStr) {
	const datetime = new Date(datetimeStr)
	let res = `${padZero(datetime.getMonth() + 1)}-${padZero(datetime.getDate())} ${padZero(datetime.getHours())}:${padZero(datetime.getMinutes())}`
	const now = new Date()
	return now.getFullYear() === datetime.getFullYear() ? res : datetime.getFullYear() + '-' + res
}

export {
	padZero,
	formatDatetime
}